<?php
$ajax_id=$_GET["ajax_id"];

require_once("includes/db_connection.php");

global $connection;

$query = "SELECT content, date, username, owner_id, superuser ";
$query .= "FROM posts ";
$query .= "INNER JOIN users ON ( posts.owner_id = users.id ) ";
$query .= "WHERE posts.complain_id = $ajax_id ";
$query .= "ORDER BY `date` DESC ";
$query .= "LIMIT 6 , 999";

$result = mysql_query($query);

while($row = mysql_fetch_array($result)) {
	if($row["superuser"] == 1) {
		echo "<div class=\"admin\"><p>";
	} else {
		echo "<div><p>";
	}
		
	echo "<h3>Autor: " . $row["username"] . ", data: " . $row["date"] . "</h3>";
	echo $row["content"] . "</p></div>";
}

mysql_close($connection);
?>